package org.projetjava.presentation;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import org.projetjava.metier.model.Lieu;
import org.projetjava.metier.model.Poi;

public class OkBoutonCreationDescription extends MouseAdapter{
	
	private CreationNewsDialogue creationNewsDialogue = null;
	private CreationPoiDialogue creationPoiDialogue = null;
	private CreationDescription creationDescription = null;
	private CreationDescriptionPoi creationDescriptionPoi = null;
	private ListePoi listePoi = null;
	private CreationDescriptionLieu creationDescriptionLieu = null;
	
	
	
	public OkBoutonCreationDescription(CreationNewsDialogue creationNewsDialogue, CreationDescription creationDescription)
	{
		this.creationNewsDialogue = creationNewsDialogue;
		this.creationDescription = creationDescription;
	}
	
	public OkBoutonCreationDescription(CreationPoiDialogue creationPoiDialogue, CreationDescriptionPoi creationDescriptionPoi)
	{
		this.creationPoiDialogue = creationPoiDialogue;
		this.creationDescriptionPoi = creationDescriptionPoi;
		
	}
	
	public OkBoutonCreationDescription(ListePoi listePoi, CreationDescriptionLieu creationDescriptionLieu)
	{
		this.listePoi = listePoi;
		this.creationDescriptionLieu = creationDescriptionLieu;
		
	}

	public void mouseClicked(MouseEvent e)
	{
		if(creationDescriptionPoi == null && creationDescriptionLieu == null)
		{
			creationNewsDialogue.getNews().setHypertext(creationDescription.getLienHyperText());
			creationNewsDialogue.getNews().setImages(creationDescription.getLienImages());
			creationDescription.setVisible(false);
		}else if(creationDescription == null && creationDescriptionLieu == null)
		{
			creationPoiDialogue.getPoi().setLienHyperText(creationDescriptionPoi.getLienHyperText());
			creationPoiDialogue.getPoi().setLienImages(creationDescriptionPoi.getLienImages());
			System.out.println("2");
			creationDescriptionPoi.setVisible(false);
		}else
		{
			listePoi.getLieu().setLienHyperText(creationDescriptionLieu.getLienHyperText());
			listePoi.getLieu().setLienImages(creationDescriptionLieu.getLienImages());
			System.out.println("8");
			creationDescriptionLieu.setVisible(false);
		}
		
	}
}
